// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

// ReSharper disable CheckNamespace
// ReSharper disable ClassNeverInstantiated.Global
// ReSharper disable CommentTypo
// ReSharper disable IdentifierTypo
// ReSharper disable InconsistentNaming
// ReSharper disable StringLiteralTypo
// ReSharper disable UnusedParameter.Local

/*
 * Ars Magna project, http://arsmagna.ru
 */

#region Using directives

using System;
using System.Collections.Generic;

#endregion

#nullable enable

namespace AM.Reporting.Utils
{
    /// <summary>
    /// Script security event arguments.
    /// </summary>
    public class ScriptSecurityEventArgs : EventArgs
    {
        /// <summary>
        /// Gets the report language.
        /// </summary>
        /// <value>The report language.</value>
        public Language ReportLanguage => Report.ScriptLanguage;

        /// <summary>
        /// Gets the report.
        /// </summary>
        /// <value>The report.</value>
        public Report Report { get; }

        /// <summary>
        /// Gets the report script.
        /// </summary>
        /// <value>The report script.</value>
        public string ReportScript { get; }

        /// <summary>
        /// Gets the references of script.
        /// </summary>
        /// <value>Script references</value>
        public string[] References { get; }

        /// <summary>
        /// Gets or sets value if script is allowed to compile
        /// </summary>
        /// <value><c>true</c> if is valid; otherwise, <c>false</c>.</value>
        public bool IsValid { get; set; } = true;

        /// <summary>
        /// Initializes a new instance of the <see cref="T:AM.Reporting.Utils.ScriptSecurityEventArgs"/> class.
        /// </summary>
        /// <param name="report">Report.</param>
        /// <param name="script">Report's script.</param>
        /// <param name="refs">Report's references.</param>
        public ScriptSecurityEventArgs (Report report, string script, string[] refs)
        {
            Report = report;
            ReportScript = script;
            References = refs;
        }
    }
}
